#ifndef INVALID_INDEX_H
#define INVALID_INDEX_H

#include <cstdio>
#include "Exception.h"
using namespace std;

class InvalidIndex: public Exception {
private:
	int min, max, val;
public:
	InvalidIndex( const char *var, int min, int max, int val ) {
		this->min = min;
		this->max = max;
		this->val = val;
		if (max > min)
			sprintf( msg, "'%s' must be from %d to %d, got %d", var, min, max, val );
		else if (max == min)
			sprintf( msg, "'%s' must be %d, got %d", var, min, max, val );
		else
			sprintf( msg, "'%s' not in indexed data, got %d", var, val );
	}
};

#endif